package com.tyk.bookstore.front.auth.valid.validator;


import com.tyk.bookstore.front.auth.model.query.LoginCodeQuery;
import com.tyk.bookstore.front.auth.strategy.factory.LoginActionFactory;
import com.tyk.bookstore.front.auth.valid.LoginCodeQueryValid;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

/**
 * @author tyk
 * @description 验证码登录参数校验
 */
public class LoginCodeQueryValidator implements ConstraintValidator<LoginCodeQueryValid, LoginCodeQuery> {
    public boolean isValid(LoginCodeQuery value, ConstraintValidatorContext context) {
        return LoginActionFactory.build(value.getType().toLoginType()).check(value);
    }
}
